﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Newtonsoft.Json.Linq;

namespace Sina.Altman.Weibo.SDK.Objects
{
    /// <summary>
    /// 可同时查询多个uid的信息
    /// </summary>
    public class Counts
    {
        public Counts(string json)
         : this(JObject.Parse(json))
        {
        }

        private JObject __jobject;
        public Counts(JObject obj)
        {
            this.__jobject = obj;
        }

        [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
        private Count[] _counts;
        public Count[] CountsInfo
        {
            get
            {
                if(_counts == null)
                    _counts = (Count[])JsonClassHelper.ReadArray<Count>(JsonClassHelper.GetJToken<JArray>(__jobject, "Counts"), JsonClassHelper.ReadStronglyTypedObject<Count>, typeof(Count[]));
                return _counts;
            }
        }

    }

    /// <summary>
    /// 我的粉丝数、围脖数、关注数等
    /// </summary>
    public class Count
    {
        public Count(string json)
         : this(JObject.Parse(json))
        {
        }

        private JObject __jobject;
        public Count(JObject obj)
        {
            this.__jobject = obj;
        }

        public string Id
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "id"));
            }
        }

        public string FollowersCount
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "followers_count"));
            }
        }

        public string FriendsCount
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "friends_count"));
            }
        }

        public string StatusesCount
        {
            get
            {
                return JsonClassHelper.ReadString(JsonClassHelper.GetJToken<JValue>(__jobject, "statuses_count"));
            }
        }
    }
}
